{% extends "base.html" %}

{% block content %}
<div class="container mt-3">
    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{{ url_for('index') }}">首页</a></li>
            <li class="breadcrumb-item"><a href="#">{{ owner.username }}</a></li>
            <li class="breadcrumb-item"><a href="{{ url_for('repo_detail', username=owner.username, repo_name=repo.name) }}">{{ repo.name }}</a></li>
            <li class="breadcrumb-item active">编辑 {{ file.name }}</li>
        </ol>
    </nav>

    <div class="d-flex justify-content-between align-items-center mb-3">
        <h2>
            <span>编辑 {{ file.name }}</span>
        </h2>
    </div>

    <form method="POST" action="{{ url_for('edit_file', username=owner.username, repo_name=repo.name, file_path=file.path) }}">
        <div class="mb-3">
            <textarea class="form-control font-monospace" id="content" name="content" rows="20">{{ file.content }}</textarea>
        </div>
        <div class="d-flex justify-content-end">
            <a href="{{ url_for('view_file', username=owner.username, repo_name=repo.name, file_path=file.path) }}" class="btn btn-outline-secondary me-2">取消</a>
            <button type="submit" class="btn btn-primary">保存</button>
        </div>
    </form>
</div>
{% endblock %}
